<?php
// $Id: page.tpl.php,v 1.18.2.1 2009/04/30 00:13:31 goba Exp $
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
  <head>
    <?php print $head ?>
    <title><?php print $head_title ?></title>
    <?php print $styles ?>
    <?php print $scripts ?>
    <!--[if lt IE 7]>
      <?php print phptemplate_get_ie_styles(); ?>
    <![endif]-->
    <script language="javascript">
      jQuery(document).ready(function() {
        //jQuery('#main_menu ul li a[class=active]').parent().addClass('active');
        //var $elem = jQuery('#main_menu a[href="' + window.location.pathname.replace(Drupal.settings.basePath, '') + '"]');
        var flag = 0;
        var $elem = jQuery('#main_menu a[href="' + window.location.pathname + '"]');
        if ($elem.length > 0) {
          $elem.parent().addClass('active');
          flag = 1;
        }
        // Check if we are in advanced search, so highlight search tab in main menu
        if (flag == 0) {
          var srchurl = Drupal.settings.basePath + 'observation/search';
          var len = srchurl.length;
          if (window.location.pathname.substr(0, len) == srchurl) {
            var $elem = jQuery('#main_menu a[href="' + srchurl + '"]');
            if ($elem.length > 0) {
              $elem.parent().addClass('active');
              flag = 1;
            }
          }
        }
      });
    </script>
  </head>
  <body<?php print phptemplate_body_class($left, $right); ?>>

<!-- Layout -->
  <!--<div id="header-region" class="clear-block"><?php print $header; ?></div>-->

    <div id="wrapper">
    <div id="container" class="clear-block">

      <div id="header">
        <div id="logo-floater">
        <?php
          // Prepare header
          $site_fields = array();
          if ($site_name) {
            $site_fields[] = check_plain($site_name);
          }
          if ($site_slogan) {
            $site_fields[] = check_plain($site_slogan);
          }
          $site_title = implode(' ', $site_fields);
          if ($site_fields) {
            $site_fields[0] = '<span>'. $site_fields[0] .'</span>';
          }
          $site_html = implode(' ', $site_fields);

          if ($logo || $site_title) {
            print '<h1><a href="'. check_url($front_page) .'" title="'. $site_title .'">';
            if ($logo) {
              print '<img src="'. check_url($logo) .'" alt="'. $site_title .'" id="logo" />';
            }
            print '</a></h1>';
          }
        ?>
        </div>
        <div id="site_slogan">
          <?php print $site_html; ?>
        </div>

        <?php if (isset($top_menu)) : ?>
          <div id="top_menu">
            <div id="topMenuLeftCurve"></div>
            <?php print $top_menu; ?>
            <div id="topMenuRightCurve"></div>
          </div>
        <?php endif; ?>
        <?php if (isset($language_switcher)) : ?>
          <div id="language_switcher">
            <?php print $language_switcher; ?>
          </div>
        <?php endif; ?>
        <?php if (isset($login_menu)) : ?>
          <div id="login_menu">
            <?php print $login_menu; ?>
          </div>
        <?php endif; ?>
        <?php if (isset($contributions_progressbar)) : ?>
          <div id="contributions_progressbar">
            <?php print $contributions_progressbar; ?>
          </div>
        <?php endif; ?>
        <?php if (isset($main_menu)) : ?>
          <div id="main_menu">
            <?php print $main_menu; ?>
          </div>
        <?php endif; ?>
        <?php if (isset($primary_links)) : ?>
          <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
        <?php endif; ?>
        <?php if (isset($secondary_links)) : ?>
          <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
        <?php endif; ?>
      </div> <!-- /header -->

      <div id="content">

        <?php if ($left): ?>
          <div id="sidebar-left" class="sidebar">
            <?php if ($search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
            <?php print $left ?>
          </div>
        <?php endif; ?>

        <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
            <!-- <?php print $breadcrumb; ?> -->
            <?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?>
            <?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
            <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
            <?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
            <?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
            <?php if ($show_messages && $messages): print $messages; endif; ?>
            <div id="messages"></div>
            <?php print $help; ?>
            <div class="clear-block">
              <?php print $content ?>
            </div>
            <?php print $feed_icons ?>
            <div id="statCounter" align="center"><div id="statCounter"><?php print $stat_counter; ?></div></div>
        </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->

        <?php if ($right): ?>
          <div id="sidebar-right" class="sidebar">
            <?php if (!$left && $search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
            <?php print $right ?>
          </div>
        <?php endif; ?>

      </div> <!-- content -->

    </div> <!-- /container -->
    <div id="footer" align="center"><div id="footerContent"><?php print $footer_message . $footer ?></div></div>
  </div>
<!-- /layout -->

  <?php print $closure ?>
  </body>
</html>